﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Himp.Platform.Api
{
    public static class OpenApiOutputExtensions
    {
        public static OpenApiOutput ReturnError(this OpenApiOutput openApiOutput)
        {
            openApiOutput.InfCode = -1;
            openApiOutput.RespondTime = DateTime.Now.ToString("yyyyMMddHHmmssfff");
            openApiOutput.ErrMsg = "未知错误";

            return openApiOutput;
        }

        public static OpenApiOutput ReturnError(this OpenApiOutput openApiOutput, string errMsg)
        {
            openApiOutput.InfCode = -1;
            openApiOutput.RespondTime = DateTime.Now.ToString("yyyyMMddHHmmssfff");
            openApiOutput.ErrMsg = errMsg;

            return openApiOutput;
        }

        public static OpenApiOutput ReturnOk(this OpenApiOutput openApiOutput,string output)
        {
            openApiOutput.InfCode = 0;
            openApiOutput.RespondTime = DateTime.Now.ToString("yyyyMMddHHmmssfff");
            openApiOutput.Output = output;

            return openApiOutput;
        }
    }
}
